package classLoader;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import classLoader.DynamicClassLoader;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Daryna_Ragimova
 */
public class MyClassLoader {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        for (;;) {
            try {
                
                ClassLoader loader= new DynamicClassLoader();
                Class clazz= Class.forName("TestModule",true,loader);
                Object object= clazz.newInstance();
                System.out.println(object);
                new BufferedReader(new InputStreamReader(System.in)).readLine();
            } catch (IOException ex) {
                Logger.getLogger(MyClassLoader.class.getName()).log(Level.SEVERE, null, ex);
            } catch (InstantiationException ex) {
                Logger.getLogger(MyClassLoader.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IllegalAccessException ex) {
                Logger.getLogger(MyClassLoader.class.getName()).log(Level.SEVERE, null, ex);
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(MyClassLoader.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }
}
